<template>
  <el-row :gutter="25">
    <el-col :span="6" :xs="24">
      <el-card>
        <div class="title">
          <span>总计用户</span>
        </div>
        <div class="content">
          {{ totalData.userTotal }}
        </div>
      </el-card>
    </el-col>
    <el-col :span="6" :xs="24">
      <el-card>
        <div class="title">
          <span>应用总计</span>
        </div>
        <div class="content">
          {{ totalData.clientTotal }}
        </div>
      </el-card>
    </el-col>
    <el-col :span="6" :xs="24">
      <el-card>
        <div class="title">
          <span>应用总计访问量</span>
        </div>
        <div class="content">
          {{ totalData.loginTotal }}
        </div>
      </el-card>
    </el-col>
    <el-col :span="6" :xs="24">
      <el-card>
        <div class="title">
          <span>系统在线用户</span>
        </div>
        <div class="content">
          {{ totalData.onlineTotal }}
        </div>
      </el-card>
    </el-col>
  </el-row>
</template>

<script>
import { getTotal } from '@/api/dashboard'

export default {
  name: 'Summarized',
  data() {
    return {
      totalData: {
        clientTotal: 2,
        loginTotal: 3,
        userTotal: 2,
        onlineTotal: 1
      }
    }
  },
  created() {
    this.getTotal()
  },
  methods: {
    getTotal() {
      getTotal().then(res => {
        this.totalData = res.data
      })
    }
  }
}

</script>

<style scoped lang="scss">
.el-row {
  .el-col-xs-24 {
    margin-bottom: 10px;
  }

  .el-col {
    .el-card {
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;

      .title{
        color: rgba(0, 0, 0, 0.6);
        font-size: 14px;
        line-height: 25px;
      }

      .content{
        color: rgba(0, 0, 0, 0.7);
        font-size: 30px;
        font-weight: bold;
        text-align: center;
      }
    }
  }
}
</style>
